#ifndef DVADDEDITREGIONDIALOG_H
#define DVADDEDITREGIONDIALOG_H

#include <QDialog>
#include "dvDatabaseController.h"
#include "dvDatabaseControllerUsable.h"

namespace Ui {
class dvAddEditRegionDialog;
}

class dvAddEditRegionDialog : public QDialog, public dvDatabaseControllerUsable
{
    Q_OBJECT
    
public:
    explicit dvAddEditRegionDialog(QWidget *parent = 0);
    ~dvAddEditRegionDialog();
    void Initialize();

    inline void setMapId(const QVariant& id){ m_mapId = id; }
    inline void setRegionId(const QVariant& id){ m_regionId = id; }

    void setRegionName(const QString& name);
    void setRegionPolygon(const QString& poly);
    void setEditMode(bool edit){ m_edit = edit; }
    
private:
    Ui::dvAddEditRegionDialog *ui;
    QVariant m_mapId;
    QVariant m_regionId;
    QString  m_oldName;
    QString  m_oldPolygon;
    bool     m_edit;
    bool     m_hasNoMap;

private slots:
    void clickedOk();
    void clickedCancel();
    void currentPolygonChanged(int index);
    void clickedWithoutPoly(bool state);
};

#endif // DVADDEDITREGIONDIALOG_H
